package com.my;

import com.my.Interceptor.InterceptorDemo;
import com.my.Interceptor.LoginCheckInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Slf4j
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private InterceptorDemo interceptorDemo;

    @Autowired
    private LoginCheckInterceptor loginCheckInterceptor;
    // 注册拦截器
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        log.info("拦截器注册！！");
//        //registry.addInterceptor(interceptorDemo).addPathPatterns("/**").excludePathPatterns("/login");
//        // addInterceptor添加拦截的东西，excludePathPatterns排除拦截的路径
//        // /**任意级  /*一级
//        registry.addInterceptor(loginCheckInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
//    }
}
